package GUILayer;

import java.awt.GridLayout;

import javax.swing.JPanel;

import ModelLayer.Employee;

/**
 * 
 * UserFrame.
 * This class is creator of the userFramePanel, that is used to store guiPanels one at the time.
 * It also creates a whole set of GUIs with their panels for one user.
 * It is the userFramePanel that gets a place in the tabbed pane in the mainframe (frmTheIrishHouse).
 * 31.05.2012
 * @author Lindgren
 * @Version 0.1
 */
public class UserFrame {

	private JPanel userFramePanel;


	/**
	 * Create the panel.
	 */
	public UserFrame(Employee employee){

		userFramePanel = new JPanel();
		userFramePanel.setToolTipText("UserGUIHolder");
		userFramePanel.setLayout(new GridLayout(0, 1, 0, 0));
		userFramePanel.setName(employee.getLogin());
		userFramePanel.setFocusable(true);// how does this work?? container listener??

		MainFrame.getUserFramePanels().put(employee.getLogin(), userFramePanel);
		System.out.println("UserFrame userFramePanel mapped: "+MainFrame.getUserFramePanels().get(employee.getLogin()));

		MainGUI mainGUI = new MainGUI(employee);
		System.out.println("UserFrame mainGUI created: "+mainGUI);
		MainFrame.getMainGUIs().put(employee.getLogin(), mainGUI);

		SaleGUI saleGUI = new SaleGUI(employee);
		System.out.println("UserFrame saleGUI created: "+saleGUI);
		MainFrame.getSaleGUIs().put(employee.getLogin(), saleGUI);
		System.out.println("UserFrame saleGUI mapped: "+MainFrame.getSaleGUIs().get(employee.getLogin()));

		DraughtBeerGUI draughtBeerGUI = new DraughtBeerGUI(employee);
		System.out.println("UserFrame draughtBeerGUI created: "+draughtBeerGUI);
		MainFrame.getDraughtBeerGUIs().put(employee.getLogin(), draughtBeerGUI);

		PaymentGUI paymentGUI = new PaymentGUI(employee);
		System.out.println("UserFrame paymentGUI created: "+paymentGUI);
		MainFrame.getPaymentGUIs().put(employee.getLogin(), paymentGUI);

		BottledBeerGUI bottledBeerGUI = new BottledBeerGUI(employee);
		System.out.println("UserFrame bottledBeerGUI created: "+bottledBeerGUI);
		MainFrame.getBottledBeerGUIs().put(employee.getLogin(),	bottledBeerGUI);

		EventGUI eventGUI = new EventGUI(employee);
		System.out.println("UserFrame eventGUI created: "+eventGUI);
		MainFrame.getEventGUIs().put(employee.getLogin(), eventGUI);

	}
}
